#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>

/* 1990年1月1日 是星期一 */

//判断闰年
bool isLeap(int year)
{
    if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0)
    {
        return true;
    }
    else
    {
        return false;
    }
}

//判断输入日期有效性
bool isValid(int year, int month, int day)
{
    if (year < 1990)
    {
        return false;
    }

    if (month < 1 || month > 12)
    {
        return false;
    }

    int leap = isLeap(year) ? 1 : 0;
    char monthdays[] = {31, 28 + leap, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    if (day < 1 || day > monthdays[month - 1])
    {
        return false;
    }

    return true;
}

int main()
{
    int year, month, day, week, leap;
    int sum = 0;
    int i;

    scanf("%d/%d/%d", &year, &month, &day);
    if (!isValid(year, month, day))
    {
        printf("输入日期无效！\n");
        return EXIT_FAILURE;
    }

    for (i = 1990; i < year; i++)
    {
        if (isLeap(i))
        {
            sum += 366;
        }
        else
        {
            sum += 365;
        }
    }

    if (isLeap(year))
    {
        leap = 1;
    }
    else
    {
        leap = 0;
    }

    char monthdays[] = {31, 28 + leap, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    for (i = 0; i < month - 1; i++)
    {
        sum += monthdays[i];
    }

    sum += day;
    week = sum % 7;

    char* weeknames[] = {"日", "一", "二", "三", "四", "五", "六"};
    printf("%d年%d月%d日是星期%s\n", year, month, day, weeknames[week]);

    return EXIT_SUCCESS;
}